package com.woyowodaows.adapter.home;

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.woyowodaows.R;
import com.woyowodaows.bean.home.NearRepairBean;
import com.woyowodaows.bean.home.OrderInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * 平台列表
 */

public class HomeOrderAdapter extends BaseQuickAdapter<NearRepairBean, BaseViewHolder> {



    public HomeOrderAdapter() {
        super(R.layout.item_mine_order);
    }

//    public void setType(int type) {
//        this.type = type;
//    }

//    private ArrayList<PlatformBean> mList;
//
//    public void setmList(ArrayList<PlatformBean> mList) {
//        this.mList = mList;
//        setNewData(mList);
//    }

    @Override
    protected void convert(final BaseViewHolder helper, NearRepairBean item) {



        TextView tv_order_infrom = helper.getView(R.id.tv_order_infrom);//订单信息
        tv_order_infrom.setText(item.getTitle());

        TextView tv_order_state = helper.getView(R.id.tv_order_state);//订单状态
        //  "gradeStatus": 0,

        TextView tv_order_time = helper.getView(R.id.tv_order_time);//订单时间
        tv_order_time.setText(item.getCreateTime());

        TextView tv_order_number = helper.getView(R.id.tv_order_number);//订单编号
        tv_order_number.setText(item.getOrderSn());
        TextView tv_order_address = helper.getView(R.id.tv_order_address);//订单地址
        tv_order_address.setText(item.getDistributionArea());

        switch (item.getStatus()){
            case -1:
                tv_order_state.setText("过期关闭");
                tv_order_state.setBackgroundResource(R.drawable.shape_bg_bule_small);
                break;
            case 0:
                tv_order_state.setText("订单取消");
                tv_order_state.setBackgroundResource(R.drawable.shape_bg_bule_small);
                break;
            case 1:
                tv_order_state.setText("待接单");
                tv_order_state.setBackgroundResource(R.drawable.shape_bg_bule_small);
                break;
            case 3:
                tv_order_state.setText("已接单");
                tv_order_state.setBackgroundResource(R.drawable.shape_bg_bule_small);
                break;
            case 4:
                  if( item.getGradeStatus() == 0){// 0待评价  1 已经评价
                      tv_order_state.setText("待评价");
                      tv_order_state.setBackgroundResource(R.drawable.shape_bg_bule_small);
                  }else {
                      tv_order_state.setText("已完成");
                      tv_order_state.setBackgroundResource(R.drawable.shape_bg_red_small);
                  }
                break;
        }


    }


}
